package com.logistics.socket.model;

import com.logistics.delivery.entity.domain.Delivery;
import com.logistics.delivery.entity.model.DeliveryRow;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class RequestTaskModel {

    private String type;

    private String deviceId;

    private String startStation;

    private String endStation;

    private String deliveryId;

    private BigDecimal unloadHeight;

    private BigDecimal unloadDownloadHeight;

    private BigDecimal loadHeight;

    private BigDecimal containHeight;

    public RequestTaskModel(){

    }

    public static RequestTaskModel build(String type, String deviceId,String startStation, String endStation, String deliveryId) {
        RequestTaskModel requestTaskModel = new RequestTaskModel();
        requestTaskModel.setType(type);
        requestTaskModel.setDeviceId(deviceId);
        requestTaskModel.setStartStation(startStation);
        requestTaskModel.setEndStation(endStation);
        requestTaskModel.setDeliveryId(deliveryId);
        return requestTaskModel;
    }

    public static RequestTaskModel build(DeliveryRow row, String agv){
        RequestTaskModel requestTaskModel = new RequestTaskModel();
        requestTaskModel.setType(row.getType());
        requestTaskModel.setDeviceId(agv);
        requestTaskModel.setStartStation(row.getStartStation());
        requestTaskModel.setEndStation(row.getEndStation());
        requestTaskModel.setDeliveryId(row.getId().toString());
        requestTaskModel.setUnloadHeight(row.getUnloadHeight());
        requestTaskModel.setUnloadDownloadHeight(row.getUnloadDownloadHeight());
        requestTaskModel.setLoadHeight(row.getLoadHeight());
        requestTaskModel.setContainHeight(row.getContainHeight());
        return requestTaskModel;
    }

    public static RequestTaskModel build(String type, String deviceId, String endStation, String deliveryId) {
        RequestTaskModel requestTaskModel = new RequestTaskModel();
        requestTaskModel.setType(type);
        requestTaskModel.setDeviceId(deviceId);
        requestTaskModel.setEndStation(endStation);
        requestTaskModel.setDeliveryId(deliveryId);
        return requestTaskModel;
    }

    public static RequestTaskModel build(String type, String deviceId, String location) {
        RequestTaskModel requestTaskModel = new RequestTaskModel();
        requestTaskModel.setType(type);
        requestTaskModel.setDeviceId(deviceId);
        requestTaskModel.setEndStation(location);
        return requestTaskModel;
    }
}
